package com.cherry.javaee.demo.service.impl;

import com.cherry.javaee.demo.dao.IUserDao;
import com.cherry.javaee.demo.domain.User;
import com.cherry.javaee.demo.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements IUserService {

//    @Autowired
//    private IUserDao mUserDao;

    @Resource(name = "userDao1")
    private IUserDao mUserDao;

    //bean.xml专用
//    public void setmUserDao(IUserDao mUserDao) {
//        this.mUserDao = mUserDao;
//    }

    public List<User> findAllUser() {
        return mUserDao.findAllUser();
    }

    public User findUser(Long id) {
        return mUserDao.findUser(id);
    }

    public void saveUser(User user) {
        mUserDao.saveUser(user);
    }

    public void update(User user) {
        mUserDao.update(user);
    }

    public void deleteUser(Long id) {
        mUserDao.deleteUser(id);
    }
}
